package com.lyl.controller;

import com.lyl.model.LoginForm;
import com.lyl.model.LoginUser;
import com.lyl.model.Result;
import com.lyl.service.LoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lylbell
 * @date 2021-06-28 16:58
 */
@RestController
@Api(tags = "会员登录")
public class LoginController {

    @Autowired
    private LoginService loginService;


    @PostMapping("/login")
    @ApiOperation(value="登录表单的信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "loginForm",value = "登录表单")
    })
    public Result<LoginUser> login(@RequestBody LoginForm loginForm) {
        LoginUser loginUser = loginService.login(loginForm);
        return Result.ok(loginUser);
    }
}
